﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Qianli.DirSir.Model;
using Qianli.DirSir.Common;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;


namespace Qianli.DirSir.DAL
{
    public class InventoryDAL
    {
        SQLHelper helper = new SQLHelper();

        /// <summary>
        /// 显示库存信息
        /// </summary>
        /// <returns></returns>
        public List<InventoryInformationInfo> ShowInventory()
        {
            string sql = "select InventoryInformationID,StorehouseName,GoodsName,InventoryInformationNum from InventoryInformationInfo join StorehouseInfo on InventoryInformationInfo.StorehouseID=StorehouseInfo.StorehouseID join GoodsInfo on InventoryInformationInfo.GoodsID=GoodsInfo.GoodsID";
            DataTable table = helper.ExecDataTable(sql);
            List<InventoryInformationInfo> list = new List<InventoryInformationInfo>();
            foreach (DataRow item in table.Rows)
            {
                InventoryInformationInfo i = new InventoryInformationInfo();
                i.InventoryInformationID = Convert.ToInt32(item["InventoryInformationID"]);
                i.StorehouseName = item["StorehouseName"].ToString();
                i.GoodsName = item["GoodsName"].ToString();
                i.InventoryInformationNum = Convert.ToInt32(item["InventoryInformationNum"]);
                list.Add(i);
            }
            return list;

        }


    }
}
